let marbleRaceLevel15_2 = {
	name: 'Game 15 Level 2',
	id: '15_2',
	type: 'elimination',
	eliminated: 1,
	objects: [
		// Portals
		{
			type: 'object',
			shape: 'rect',
			color: '@goal',
			toPortal: 'goal',
			isGoal: true,
			x: 340,
			y: 540 - 10,
			width: 520,
			height: 20
		},
		{
			type: 'object',
			shape: 'circle',
			color: '@a',
			portalID: 'a',
			x: 150,
			y: 80,
			radius: 5
		},

		// Goal portal
		{
			type: 'object',
			shape: 'circle',
			color: '@goal',
			portalID: 'goal',
			x: 700,
			y: 80,
			radius: 5
		},

		// Obstacles

		// Borders
		{
			type: 'object',
			shape: 'rect',
			color: '@tertiary',
			x: 400,
			y: 0,
			width: 800,
			height: 120
		},
		{
			type: 'object',
			shape: 'rect',
			color: '@tertiary',
			x: 400,
			y: 600,
			width: 800,
			height: 120
		},
		{
			type: 'object',
			shape: 'rect',
			color: '@tertiary',
			x: 0,
			y: 300,
			width: 160,
			height: 600
		},
		{
			type: 'object',
			shape: 'rect',
			color: '@tertiary',
			x: 800,
			y: 300,
			width: 160,
			height: 600
		},
		{
			type: 'object',
			shape: 'rect',
			color: '@tertiary',
			x: 640,
			y: 300,
			width: 80,
			height: 600
		},

		// Marbles
		{
			type: 'marbles',
			x: 150,
			y: 80,
			launchTime: 3,
			launchRadius: 75,
			passX: 700,
			passY: 80,
			radius: 8,
			eliminatedRadius: 6,
			velocity: 5
		},
	]
}
{
	let cntI = 1
	for (let i = 0; i <= cntI; ++i) {
		let cntJ = 2
		for (let j = 0; j <= cntJ; ++j) {
			let x0 = (i & 1) ? (680 - 145 - j * 125) : (145 + j * 125)
			let y0 = 200 + i * 200
			let omega = 5
			if (i & 1)
				omega = -omega
			marbleRaceLevel15_2.objects.push({
				type: 'object',
				shape: 'rect',
				color: '@secondary',
				x: x0,
				y: y0,
				width: 10,
				height: 120,
				onBeforeUpdate: function (object, engine) {
					engine.setAngle(object.body, omega * engine.time)
				}
			})
			marbleRaceLevel15_2.objects.push({
				type: 'object',
				shape: 'polygon',
				color: '@secondary',
				x: x0,
				y: y0 + 50,
				vertices: [
					{ x: 65, y: 100 },
					{ x: 65, y: 0 },
					{ x: 60, y: 0 },
					{ x: 60, y: 60 },
					{ x: 40, y: 80 },
					{ x: -40, y: 80 },
					{ x: -60, y: 60 },
					{ x: -60, y: 0 },
					{ x: -65, y: 0 },
					{ x: -65, y: 100 },
				]
			})
		}
	}
}
marbleRaceLevels.push(marbleRaceLevel15_2)